//
//  XFBaseNavController.m
//  SinaBlog_OC
//
//  Created by macs on 15/11/17.
//  Copyright © 2015年 BlackTail. All rights reserved.
//

#import "XFBaseNavController.h"

@interface XFBaseNavController ()

@end

@implementation XFBaseNavController

- (void)viewDidLoad {
  [super viewDidLoad];
  // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
  [super didReceiveMemoryWarning];
  // Dispose of any resources that can be recreated.
}

- (instancetype)initWithRootViewController:(UIViewController *)rootViewController{
    if (self = [super initWithRootViewController:rootViewController]) {
        [self.navigationBar setTintColor:[UIColor orangeColor]];
    }
    return  self;
}

- (void)pushViewController:(UIViewController *)viewController
                  animated:(BOOL)animated {

  if (self.childViewControllers.count != 0) {
    viewController.navigationItem.backBarButtonItem =
        [[UIBarButtonItem alloc] initWithTitle :
        @"返回" style : UIBarButtonItemStylePlain target : self action :
      @selector(back)];
      viewController.hidesBottomBarWhenPushed = YES;
  }

  [super pushViewController:viewController animated:animated];
}

- (void)back {
  [self.navigationController popViewControllerAnimated:YES];
}

@end
